package com.freework.sys.permissions.system.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.freework.freedbm.dao.TotalResult;
import com.freework.freedbm.exception.DAOException;
import com.freework.sys.permissions.external.service.SessionInfo;
import com.freework.sys.permissions.system.dao.GroupDAO;
import com.freework.sys.permissions.system.vo.SysGroupVO;
import com.freework.sys.permissions.system.vo.UserVO;
import com.freework.tree.TreeDatas;
import com.freework.util.FormatUtil;
@Service("freework.sys.permissions.system.service.GroupEditServiceImpi")
public class GroupEditServiceImpi implements GroupEditServiceI {
	@Resource
	GroupDAO dao=null;
	public void setDao(GroupDAO dao) {
		this.dao = dao;
	}
	public void addGroup(SysGroupVO dto, String[] funcid) throws DAOException {
		dto.setCreatetime(FormatUtil.stringDateTime2());
		Integer Userid=SessionInfo.getUser().getUserid();
		dto.setCreateuser(Userid);
		dao.insertPermission(dto, funcid);

	}

	public void deleteGroup(String[] ids) {
		dao.delete(ids);
	}

	public List<TreeDatas> queryGroupFunc(Integer groupid,UserVO u) {
		return dao.queryGroupFunc(groupid,u);
	}

	public TotalResult<SysGroupVO> queryPage(int start, int limit,
			SysGroupVO dto) {
		return dao.queryPage(start, limit, dto);
	}

	public void updateGroup(SysGroupVO dto, String[] funcid) throws DAOException {
		dao.updatePermission(dto, funcid);

	}

}
